class Solution {
    public:
        bool isBalanced(string num) {
            int s = 0;
            for (int i = 0; i < num.length(); i++) {
                int c = num[i] - '0';
                s += i % 2 ? c : -c;
            }
            return s == 0;
        }
    };
    